// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

cc.Class({
    extends: cc.Component,

    properties: {
        // foo: {
        //     // ATTRIBUTES:
        //     default: null,        // The default value will be used only when the component attaching
        //                           // to a node for the first time
        //     type: cc.SpriteFrame, // optional, default is typeof default
        //     serializable: true,   // optional, default is true
        // },
        // bar: {
        //     get () {
        //         return this._bar;
        //     },
        //     set (value) {
        //         this._bar = value;
        //     }
        // },
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

        _SKILLCREATER.createSkill();

        _NPCHELPER.importNpc();

        //_NPCHELPER.createTz();

        _QD.initQd();

        _STEAM.init();

        VDM.init();

        //_MSD.initUi(this.node.getChildByName('savelabel'),false);

        this.node.getChildByName('qidong').getChildByName('continuegame').on(cc.Node.EventType.TOUCH_START,function(){

            //this.node.getChildByName('savelabel').active = true;
            window._JUMPSENCE = "goon";
            cc.director.loadScene('jump');

        }, this);

        this.node.getChildByName('qidong').getChildByName('newgame').on(cc.Node.EventType.TOUCH_START,function(){
            //this.node.getChildByName('savelabel').active = true;
            window._JUMPSENCE = "random";
            cc.director.loadScene('jump');

            //cc.director.loadScene('beginStory');

            /*
            window.gameData = _GAMEDATAHELPER.getInitData(this.randomRole);
            window.gameData.playerTeam = [
                _ROF.createRole('林冲')
            ]
            window.gameData.hdlv = 0;
            window.gameData.targetPoint="汜水关前";//目标坐标点
            window.gameData.defaultMap = '大地图';//默认地图
            //_TM.addAll();
            window._JUMPSENCE = "map";
            cc.director.loadScene('jump');
            */
        }, this);

        this.node.getChildByName('status').getChildByName('mask').on(cc.Node.EventType.TOUCH_START,function(){
            this.node.getChildByName('status').active = false;
        }, this);

        //显示版本更新
        _GVHELPER.showVersion(this.node.getChildByName('status'));

        this.node.getChildByName('version').getComponent(cc.Label).string = _QD.getQdLabel()+"."+_GVHELPER.version;

        this.node.getChildByName('version').on(cc.Node.EventType.TOUCH_START,function(){
            _GVHELPER.realShowVersion(this.node.getChildByName('status'));
        }, this);

        this.node.getChildByName('qidong').getComponent(cc.Animation).play('qidong');
		
		_MWX.showCustomAd();

        _TM.testAllConfigXy();

    },

    // update (dt) {},
});
